package com.hospital.enumeration;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import com.hospital.constant.MessageConstant;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum BedStatus {
    AVAILABLE("空闲"),
    OCCUPIED("已占用");

    @EnumValue
    @JsonValue
    private final String value;

    public static BedStatus fromValue(String value) {
        for (BedStatus status : BedStatus.values()) {
            if (status.getValue().equals(value)) {
                return status;
            }
        }
        throw new IllegalArgumentException(MessageConstant.PARAM_ERROR);
    }
}
